#@layout()

#define script()
<script>

    function doDel(id) {
        ajaxGet("/admin/LinkManage/jpress_addon_link_list/doDel/" + id);
    }

    $("#batchDel").click(function () {
        var ids = getSelectedIds();
        if (ids == "") {
            alert('您未选择任何条目');
            return
        }
        ajaxGet("/admin/LinkManage/jpress_addon_link_list/doDelByIds?ids=" + ids);
    })

</script>
#end

#define content()
<div class="content-wrapper">

    <section class="content-header">
        <h1>
            管理
            <small>Items</small>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">
                    <div class="box-header with-border">

                        <form class="form-horizontal actionPanel" action="#(CPATH)/admin/LinkManage/jpress_addon_link_list" method="get">
                            <input type="hidden" name="status" value="#para('status')">
                            <div class="row">
                                <div class="form-group col-lg-3">
                                    <label class="col-sm-3 control-label">标题关键字</label>
                                    <div class="col-sm-9">
                                        <input type="text" class="form-control" name="key" value="#para('title' ??)">
                                    </div>
                                </div>
                                <div class="form-group col-lg-3">
                                    <label class="col-sm-3 control-label">分类</label>
                                    <div class="col-sm-9">
                                        <select class="form-control" name="type">
                                            <option value="">全部分类</option>
                                            #LinkManagesTypeAll()
                                                #for(linkType : LinkTypes)
                                                    <option value="#(linkType.id)">#(linkType.name)</option>
                                                #end
                                            #end
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group col-lg-3">
                                    <label class="col-sm-3 control-label">网站状态</label>
                                    <div class="col-sm-9">
                                        <select  name="state" class="form-control" >
                                            <option value="">全部状态</option>
                                            <option value="1">通过</option>
                                            <option value="2">失效</option>
                                            <option value="3">待审核</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group col-lg-3">
                                    <div class="col-sm-12">
                                        <button type="submit" class="btn btn-primary ">查询</button>
                                    </div>
                                </div>
                            </div>
                            <!-- /.box-body -->
                        </form>
                        <div class="row actionPanel">
                            <div class="col-xs-12">
                                <a href="jpress_addon_link_list/edit" class="btn btn-primary ">
                                    <i class="fa fa-fw fa-plus"></i> 新建
                                </a>
                                <button type="submit" id="batchDel" class="btn btn-default checkAction"> 批量删除</button>
                            </div>
                        </div>

                    </div>
                    <!-- /.box-header -->
                    <div class="box-body ">

                        <table class="table table-striped">
                            <tbody>
                            <tr>
                                <th style="width: 10px">
	                                    <input name="dataItem" onchange="checkAll(this)" type="checkbox"/>
	                                </th>
	                                <th>ID</th>
	                                <th>网站标题</th>
	                                <th>网站描述</th>
	                                <th>网站LOGO</th>
	                                <th>网址</th>
	                                <th>网站分类</th>
	                                <th>添加时间</th>
	                                <th>称呼</th>
	                                <th>联系邮箱</th>
	                                <th>网站状态</th>
	                                <th>备注</th>

                            </tr>
                            #for(entry : page.list)
                            <tr class="jp-actiontr">
                                <td><input class="dataItem" type="checkbox" value="#(entry.id)" />
                                </td>
                                <td>
                                    <strong>
                                        <a href="#(CPATH)/admin/LinkManage/jpress_addon_link_list/edit/#(entry.id)"> #(entry.id ??) </a>
                                    </strong>
                                    <div class="jp-actionblock">
                                        <div class="jp-actionitem">
                                            <a href="/admin/LinkManage/jpress_addon_link_list/edit/#(entry.id)">编辑</a> |
                                            <a href="javascript:;" class="red-action"
                                               onclick="doDel('#(entry.id)')">删除</a>
                                        </div>
                                    </div>
                                </td>

	                                <td>#(entry.title)</td>
	                                <td>#(entry.description)</td>
	                                <td>
                                        <img src="#(entry.logo)" style="width: 50px;height: 50px">
                                    </td>
	                                <td>
                                        <a target="_blank" href="#(entry.url)">#(entry.url)</a>
                                    </td>
	                                <td>
                                        #LinkManageTypeById(type=entry.type)
                                        <a href="/admin/LinkManage/jpress_addon_link_list?type=#(LinkType.id)">
                                            #(LinkType.name)
                                        </a>
                                        #end
                                    </td>
	                                <td>#(entry.time)</td>
	                                <td>#(entry.name)</td>
	                                <td>#(entry.email)</td>
	                                <td>
                                        <a href="/admin/LinkManage/jpress_addon_link_list?state=#(entry.state)">
                                            #if(entry.state == 1)
                                                通过
                                            #elseif(entry.state == 2)
                                                失效
                                            #else
                                                待审核
                                            #end
                                        </a>
                                    </td>
	                                <td>#(entry.remark)</td>
                            </tr>
                            #end
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer">
                        <div class="row">
                            <div class="col-sm-12">
                            	 #@_paginate()
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.box -->
            </div>
        </div>

    </section>
</div>
#end